You are here: Scripting examples > Creating a backup of the target by rotating connections

Creating a backup of the target by rotating connections

The following two scripts create multiple copies of your data on the target, but only one copy is active at a time. This allows you the time and availability to backup the inactive copy of data. This is especially helpful when you have applications with interdependent files.

Backups occur sequentially from the first file to the last file. Therefore, when you are using applications that have interdependent files, such as a database application whose database and log files must be synchronized, Double-Take Availability cannot be actively updating files on the target while the backup is running, or there becomes an opportunity for interdependent files to become mismatched, causing a corrupt application on the backup. For example, suppose the following scenario occurs on a target machine that contains a replica of a database.

  1. The backup process which is currently running sequentially through the files on the target, reaches the database log file and starts writing the log file to tape. At the same time, Double-Take Availability receives additional updates to the database. The database file on the target is updated, but since the log file is in use by the backup, the associated log operation is placed on the Double-Take Availability queue on the target.
  2. When the log file is finished being backed up, the backup process continues with the next sequential file, which is not necessarily the database that corresponds with that log file.
  3. Since the log file is no longer in use, Double-Take Availability applies the log operation from the Double-Take Availability queue.
  4. Eventually, the backup process reaches the database file and writes it to tape.

At this point, the database file on the tape backup contains an extra update that the log file on the tape backup does not. The two files do not correspond, so the database on the tape backup will not be time consistent.

The two scripts identify an existing connection, disconnect it, establish a new connection, and initiate a difference mirror. The connections in the two scripts transmit the same data to two different locations, allowing you to backup the idle files on the inactive connection.

# Script 1 #

$TheSource = "alpha";

$TheTarget = "beta";

$TheUser = "admin";

$ThePassword = "password";

$TheDomain = "domain.com";

$TheRepSet = "DataFiles";

login $TheSource $TheUser $ThePassword $TheDomain;

login $TheTarget $TheUser $ThePassword $TheDomain;

source $TheSource;

$FirstConnection = conid $TheRepSet to $TheTarget map base c:\first_location;

disconnect $FirstConnection;

$SecondConnection = connect $TheRepSet to $TheTarget map base c:\second_location, nomirror;

mirror start $SecondConnection different, checksum;

# Script 2 #

$TheSource = "alpha";

$TheTarget = "beta";

$TheUser = "admin";

$ThePassword = "password";

$TheDomain = "domain.com";

$TheRepSet = "DataFiles";

login $TheSource $TheUser $ThePassword $TheDomain;

login $TheTarget $TheUser $ThePassword $TheDomain;

source $TheSource;

$SecondConnection = conid $TheRepSet to $TheTarget map base c:\second_location;

disconnect $SecondConnection;

$FirstConnection = connect $TheRepSet to $TheTarget map base c:\first_location, nomirror;

mirror start $FirstConnection different, checksum;